package task06_06;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import sun.nio.cs.ext.GBK;

/**
 * Create by IntelliJ IDEA
 *
 * @author: yuanbinbing
 * @date-Time: 2018/5/4 10:20
 * @description:
 */
public class CharCode {

  public static void main(String[] args) throws Exception {
    InputStreamReader inputStreamReader =new InputStreamReader
        (new FileInputStream("d:\\a.txt"), "GBK");
    OutputStreamWriter outputStreamWriter=new OutputStreamWriter
        (new FileOutputStream("yuan.txt"),"utf-8");

    BufferedReader bufferedReader=new BufferedReader(inputStreamReader);
    BufferedWriter bufferedWriter=new BufferedWriter(outputStreamWriter);

    String line=null;
    while((line=bufferedReader.readLine())!=null){
      bufferedWriter.write(line);
      bufferedWriter.newLine();
    }
    bufferedReader.close();
    bufferedWriter.close();
    inputStreamReader.close();
    outputStreamWriter.close();
  }

}
